package com.intelligentcar.springboot.controller;

import com.intelligentcar.springboot.bean.Menu;
import com.intelligentcar.springboot.bean.Role;
import com.intelligentcar.springboot.service.MenuServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
public class MenuController {
    @Autowired
    private MenuServer menuServerImpl;

    @RequestMapping("/selectAllRole")
    @ResponseBody
    public List<Role> selectAllRole(){
        return menuServerImpl.selectAllRole();
    }

    @RequestMapping("/selectAllotMenu")
    @ResponseBody
    public List<Integer> selectAllotMenu(@RequestBody Menu menu){
        return menuServerImpl.SelectAllotMenu(menu);
    }

    @RequestMapping("/selectAllotMenu1")
    @ResponseBody
    public List<Menu> selectAllotMenu1(@RequestBody Menu menu){
        return menuServerImpl.SelectAllotMenu1(menu);
    }

    @RequestMapping("/selectAllPower")
    @ResponseBody
    public List<Menu> selectAllPower(){
        return menuServerImpl.selectAllPower();
    }

    @RequestMapping("/updatePower")
    @ResponseBody
    public boolean updatePower(@RequestBody Menu menu){
        return menuServerImpl.updatePower(menu);
    }

    @RequestMapping("/menuTable")
    @ResponseBody
    public Map<String,Object> menuTable(@RequestBody Menu menu){
        return menuServerImpl.menuTable(menu);
    }

    @RequestMapping("/updateMenu")
    @ResponseBody
    public boolean updateMenu(@RequestBody Menu menu){
        return menuServerImpl.updateMenu(menu);
    }

    @RequestMapping("/updateMenuState")
    @ResponseBody
    public boolean updateMenuState(@RequestBody Menu menu){
        return menuServerImpl.updateMenuState(menu);
    }

    @RequestMapping("/insertMenu")
    @ResponseBody
    public int insertMenu(@RequestBody Menu menu){
        return menuServerImpl.insertMenu(menu);
    }

    @RequestMapping("/selectMenu")
    @ResponseBody
    public Map<String,Object> selectMenu(@RequestBody Menu menu){
        return menuServerImpl.selectMenu(menu);
    }

    @RequestMapping("/allParentMenu")
    @ResponseBody
    public List<Menu> allParentMenu(@RequestBody Menu menu){
        return menuServerImpl.allParentMenu(menu);
    }

    @RequestMapping("/routerData")
    @ResponseBody
    public List<Menu> routerData(@RequestBody Menu menu){
        return menuServerImpl.routerData();
    }


}
